import Vue from 'vue'
import App from './App.vue'
import router from './router'
import 'default-passive-events'
import axios from 'axios'
import ElementUI from 'element-ui';
import store from './store'
import { Message } from 'element-ui';
import VueQr from 'vue-qr'
import * as echarts from 'echarts'
import 'element-ui/lib/theme-chalk/index.css';
import './assets/css/global.css'
import vueToPdf from 'vue-to-pdf';

// var jieba = require('nodejieba')

Vue.use(vueToPdf);
Vue.use(ElementUI)//全局使用elementui
Vue.use(VueQr)
// Vue.use(jieba)

Vue.prototype.$http = axios//配置http请求
axios.defaults.baseURL = 'http://106.12.141.103:8080/'//请求路径
// axios.defaults.baseURL = 'http://localhost:8080/'
axios.defaults.withCredentials = true
Vue.config.productionTip = false


Vue.prototype.$message = Message

Vue.prototype.$echarts = echarts // 图表库

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

//时间戳转时间
Vue.prototype.convertTime = function (timestamp) {
  var time = new Date(timestamp);
  var y = time.getFullYear();
  var m = time.getMonth() + 1;
  var d = time.getDate();
  var h = time.getHours();
  var mm = time.getMinutes();
  var s = time.getSeconds();
  return y + "-" + this.add0(m) + "-" + this.add0(d) + "-" + this.add0(h) + ":" + this.add0(mm) + ":" + this.add0(s);
};

Vue.prototype.add0 = function (m) {
  return m < 10 ? '0' + m : m
}